// 游戏容器
.game-container {
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	position: relative;
	overflow: hidden;
}

// 顶部信息栏
.top-info-bar {
	height: 60px;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 0 15px;
	background: transparent;
	margin-bottom: 5px;
	gap: 10px;

	// 信息卡片通用样式
	.info-card {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		gap: 6px;
		padding: 8px 12px;
		background: rgba(255, 255, 255, 0.9);
		border-radius: 20px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
		border: 2px solid rgba(255, 255, 255, 0.8);
		backdrop-filter: blur(10px);
		transition: all 0.3s ease;

		&:active {
			transform: scale(0.95);
		}

		.card-icon {
			font-size: 16px;
		}

		.card-value {
			font-size: 14px;
			font-weight: bold;
			color: #333;
		}
	}

	// 星星卡片
	.stars-card {
		position: relative;
		display: flex;
		justify-content: center;
		align-items: center;
		transform: translateY(-2px);
		.card-icon {
			color: #FFD700;
			font-size: 24px;
		}

		.card-value {
			position: absolute;
			color: #FFF;
		}
	}

	// 关卡进度卡片
	.level-progress-card {
		flex: 1;
		min-width: 0;
		max-width: 180px;
		padding: 6px 12px;

		.progress-container {
			display: flex;
			position: relative;
			flex: 1;
			min-width: 0;
			flex-direction: column;
			align-items: center;
			gap: 4px;

			.progress-bg {
				width: 100%;
				height: 14px;
				background: rgba(200, 200, 200, 0.5);
				border-radius: 4px;
				overflow: hidden;
				position: relative;

				.progress-fill {
					height: 100%;
					background: linear-gradient(90deg, #4ECDC4, #44A08D);
					border-radius: 4px;
					transition: width 0.3s ease;
				}
			}

			.progress-text {
				font-size: 11px;
				font-weight: bold;
				color: #666;
				position: absolute;
			}
		}
	}
}

// 迷宫显示区域
.maze-area {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px;
	min-height: 200px;

	.maze-canvas {
		border-radius: 15px;
		box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
		background: white;
		border: 3px solid rgba(255, 255, 255, 0.8);
		// 移除max-width和max-height限制，让canvas按照JavaScript计算的尺寸显示
		// 确保canvas能够充分利用可用空间
	}
}

// 底部控制区域
.bottom-controls {
	height: 90px;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 0 25px 15px;

	.level-select-btn {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 60px;
		height: 60px;
		background: linear-gradient(135deg, #9C27B0, #8E24AA);
		border-radius: 12px;
		box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
		transition: all 0.3s ease;

		&:active {
			transform: scale(0.95);
		}

		.level-select-icon {
			font-size: 20px;
			margin-bottom: 1px;
		}

		.level-select-text {
			font-size: 10px;
			color: white;
			font-weight: bold;
		}
	}

	.joystick-container {
		display: flex;
		align-items: center;
		justify-content: center;

		.joystick-base {
			position: relative;
			width: 70px;
			height: 70px;
			background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
			border-radius: 50%;
			box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 4px 15px rgba(0, 0, 0, 0.1);
			display: flex;
			align-items: center;
			justify-content: center;

			.joystick-stick {
				width: 35px;
				height: 35px;
				background: linear-gradient(135deg, #42A5F5, #1E88E5);
				border-radius: 50%;
				box-shadow: 0 3px 10px rgba(66, 165, 245, 0.4);
				transition: all 0.1s ease;
				border: 2px solid white;
			}
		}
	}

	.hint-button {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 60px;
		height: 60px;
		background: linear-gradient(135deg, #66BB6A, #4CAF50);
		border-radius: 12px;
		box-shadow: 0 4px 15px rgba(102, 187, 106, 0.3);
		transition: all 0.3s ease;

		&:active {
			transform: scale(0.95);
		}

		&.disabled {
			background: linear-gradient(135deg, #BDBDBD, #9E9E9E);
			box-shadow: 0 4px 15px rgba(158, 158, 158, 0.3);
		}

		.hint-icon {
			font-size: 20px;
			margin-bottom: 1px;
		}

		.hint-count {
			font-size: 10px;
			color: white;
			font-weight: bold;
		}
	}
}

// 游戏状态浮层
.game-status-float {
	position: absolute;
	top: 70px;
	left: 15px;
	right: 15px;
	display: flex;
	flex-direction: row;
	justify-content: center;
	gap: 8px;

	.status-item {
		display: flex;
		flex-direction: row;
		align-items: center;
		gap: 6px;
		padding: 6px 10px;
		background: rgba(255, 255, 255, 0.9);
		border-radius: 15px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

		.status-icon {
			font-size: 14px;
		}

		.status-text {
			font-size: 12px;
			font-weight: bold;
			color: #333;
		}
	}
	// 时间显示
	.time-display {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 8px 12px;
		background: linear-gradient(135deg, #FF6B6B, #EE5A52);
		border-radius: 20px;
		box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
		border: 2px solid rgba(255, 255, 255, 0.8);
		backdrop-filter: blur(10px);
		transition: all 0.3s ease;

		&:active {
			transform: scale(0.95);
		}

		.time-text {
			font-size: 14px;
			font-weight: bold;
			color: white;
			text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
		}
	}
}

// 弹框系统
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	backdrop-filter: blur(5px);
}

.modal-container {
	background: white;
	border-radius: 20px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	min-width: 300px;
	max-width: 90vw;
	max-height: 80vh;
	overflow: hidden;
	animation: modalSlideIn 0.3s ease-out;

	.modal-header {
		padding: 20px;
		background: linear-gradient(135deg, #667eea, #764ba2);
		color: white;
		position: relative;

		.modal-title {
			font-size: 20px;
			font-weight: bold;
			text-align: center;
		}

		.close-btn {
			position: absolute;
			right: 15px;
			top: 50%;
			transform: translateY(-50%);
			width: 30px;
			height: 30px;
			display: flex;
			align-items: center;
			justify-content: center;
			background: rgba(255, 255, 255, 0.2);
			border-radius: 50%;
			transition: all 0.3s ease;

			&:active {
				background: rgba(255, 255, 255, 0.3);
			}

			.close-icon {
				font-size: 16px;
				color: white;
			}
		}
	}

	.modal-content {
		padding: 20px;

		.warning-text {
			font-size: 16px;
			color: #666;
			text-align: center;
		}

		.result-stats {
			display: flex;
			flex-direction: column;
			gap: 15px;

			.stat-item {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				padding: 10px 15px;
				background: #F5F5F5;
				border-radius: 10px;

				.stat-label {
					font-size: 16px;
					color: #666;
				}

				.stat-value {
					font-size: 16px;
					font-weight: bold;
					color: #333;
				}
			}
		}
	}

	.modal-actions {
		padding: 20px;
		display: flex;
		flex-direction: row;
		gap: 15px;
		justify-content: center;

		.action-btn {
			flex: 1;
			padding: 15px 20px;
			border-radius: 25px;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			transition: all 0.3s ease;
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

			&:active {
				transform: scale(0.95);
			}

			&.primary {
				background: linear-gradient(135deg, #4CAF50, #45A049);
			}

			&.secondary {
				background: linear-gradient(135deg, #FF9800, #F57C00);
			}

			.btn-text {
				font-size: 16px;
				font-weight: bold;
				color: white;
			}
		}
	}
}

// 关卡选择弹框特殊样式
.level-modal {
	width: 320px;

	.level-grid {
		padding: 20px;
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		gap: 15px;

		.level-item {
			position: relative;
			width: 50px;
			height: 50px;
			display: flex;
			align-items: center;
			justify-content: center;
			background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
			border-radius: 10px;
			box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
			transition: all 0.3s ease;

			&:active {
				transform: scale(0.95);
			}

			&.current {
				background: linear-gradient(135deg, #4CAF50, #45A049);
				box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);

				.level-number {
					color: white;
				}
			}

			&.locked {
				background: linear-gradient(135deg, #BDBDBD, #9E9E9E);
				opacity: 0.6;

				.level-number {
					color: #666;
				}
			}

			.level-number {
				font-size: 16px;
				font-weight: bold;
				color: #333;
			}

			.lock-icon {
				position: absolute;
				top: -5px;
				right: -5px;
				font-size: 12px;
			}
		}
	}
}

// 动画
@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: translateY(-50px) scale(0.9);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

// 响应式设计
@media (max-width: 480px) {
	.top-info-bar {
		height: 70px;
		padding: 0 15px;

		.level-display {
			width: 50px;
			height: 50px;

			.level-number {
				font-size: 20px;
			}
		}

		.time-display {
			padding: 8px 15px;

			.time-text {
				font-size: 16px;
			}
		}

		.pause-button {
			width: 45px;
			height: 45px;

			.pause-icon {
				font-size: 18px;
			}
		}
	}

	.bottom-controls {
		height: 100px;
		padding: 0 20px 15px;

		.level-select-btn,
		.hint-button {
			width: 60px;
			height: 60px;

			.level-select-icon,
			.hint-icon {
				font-size: 20px;
			}

			.level-select-text,
			.hint-count {
				font-size: 10px;
			}
		}

		.joystick-container .joystick-base {
			width: 70px;
			height: 70px;

			.joystick-stick {
				width: 35px;
				height: 35px;
			}
		}
	}

	.level-modal {
		width: 280px;

		.level-grid {
			gap: 10px;

			.level-item {
				width: 45px;
				height: 45px;

				.level-number {
					font-size: 14px;
				}
			}
		}
	}
}